<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, viewport-fit=cover, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta name="format-detection" content="telephone=no,email=no">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="origin-trial" data-feature="Web Share" content="TOKEN_FROM_THE_EMAIL">
    <link rel="stylesheet" href="/static/modular/xyt/css/weui.min.css">
    <link rel="stylesheet" href="/static/modular/xyt/css/jquery-weui.min.css">
    <link rel="stylesheet" href="/static/modular/xyt/css/base.css">
    <link rel="stylesheet" href="/static/modular/xyt/css/index.css">

    <!-- 优先加载 px转换rem -->
    <script src="/static/modular/xyt/js/flexible.js"></script>
    <script src="/static/modular/xyt/js/jquery-2.1.4.min.js"></script>
	<script src="/static/modular/xyt/js/jquery-weui.js"></script>

    <script src="/static/js/plugins/js-base64/base64.min.js"></script>
	<script src="/static/js/Feng.js"></script></head>
     <script type="text/javascript" src="/static/js/jqueryMobile.ext.js"></script>
      <script type="text/javascript" src="/js/base.js"></script>
	<script src="/static/js/jweixin-1.2.0.js"></script>
	    <!-- 弹出框 -->
	<script src="/third/layer/layer.min.js" type="text/javascript"></script>
		    <!-- validate -->
	<link rel="stylesheet" href="/third/validate/jquery.validate.css" type="text/css">
	<script type="text/javascript" src="/third/validate/jquery.validate.min.js"></script>
	<script type="text/javascript" src="/third/validate/additional-methods.min.js"></script>
	<script type="text/javascript" src="/third/validate/messages_zh.min.js"></script>


<!-- 	<script src="https://cdn.bootcss.com/echarts/4.3.0-rc.2/echarts.min.js"></script> -->
<!-- 	<script src="/static/modular/xyt/js/echarts-4.3.1.min.js"></script> -->
		<script src="/static/modular/xyt/js/common.js?v=2.0"></script>
		<script type="text/javascript">
	        Feng.addCtx("");
		</script>
</head>

<script>

    function formatDate(now)
    {
        // var now = new Date();
        var year = now.getFullYear();       //年
        var month = now.getMonth() + 1;     //月
        var day = now.getDate();            //日

        var hh = now.getHours();            //时
        var mm = now.getMinutes();          //分

        var clock = year + "年";

        if(month < 10)
            clock += "0";

        clock += month + "月";

        if(day < 10)
            clock += "0";

        clock += day + "日";

        return(clock);
    }

    function wordStatic(input) {
        // 获取要显示已经输入字数文本框对象
        var content = $(input).parent().find(".textNum");
        if (content && input) {
            // 获取输入框输入内容长度并更新到界面
            var value = input.value;
            // 将换行符不计算为单词数
            value = value.replace(/\n|\r/gi,"");
            // 更新计数
            content.html(value.length);
            content.show();
        }
    }


    function getWhereData(formid){
    	var data = new FormData();
        var param = {};
        $("#"+formid).find("input:hidden,input:text,select").each(function () {
            var name = $(this).attr("name");//获取name属性
            var value=$(this).val();
            if(null!=name ){
                var type=$(this).get(0).type;
                data.append(name, value)
            }
        });
        $("#"+formid).find('input:radio,input:checkbox').filter(':checked').each(function () {
            var name = $(this).attr("name");//获取name属性
            var value=$(this).val();
            if(null!=name){
            	data.append(name, value)
            }
        });
        $("#"+formid).find("textarea").each(function () {
            var name = $(this).attr("name");//获取name属性
            var value=$(this).val();
            if(null!=name){
            	data.append(name, value)
            }
        });
        return data;
    }

</script>
 <head>
    <title>每日报平安</title>
</head>
<body>
<main>
    <!-- 中间内容 -->
    <section class="w100 main-wrapper" style="padding-bottom: 1.2rem;">
        <form id="f" action="" method="POST" class="fn-pb10 label-flex-form">
         <input type="hidden" name="ttoken" value="5df085b1-ce8a-4bed-aab5-07888efc195f"/>
<!--              <input type="hidden" name="applyid" id="applyid" value=""/> -->
		 <input type="hidden" name="province" id="province" value=""/>
		  <input type="hidden" name="city" id="city" value=""/>
		   <input type="hidden" name="district" id="district" value=""/>
		   <input type="hidden" name="adcode" id="adcode" value=""/>
 		   <input type="hidden" name="longitude" id="longitude" value="0"/>
 		   <input type="hidden" name="latitude" id="latitude" value="0"/>

 		   <input type="hidden" name="sfqz" id="sfqz" value=""/>
 		   <input type="hidden" name="sfys" id="sfys" value=""/>
 		   <input type="hidden" name="sfzy" id="sfzy" value=""/>
		   <input type="hidden" name="sfgl" id="sfgl" value=""/>
 		    <input type="hidden" name="status" id="status" value="1"/>

<!--		    <input type="hidden" name="sfgr" id="sfgr" value=""/>-->

            <div class="weui-cells weui-cells_form border-lists bd-radius5 weui-cell-border fn-mt00">

                <h3 class="ai-padding bg-default normal-font fc-gray4">今日情况</h3>
                <div class="weui-cell ai-padding">
                    <div class="weui-cell__hd normal-font">姓名</div>
                    <div class="weui-cell__bd normal-font fn-ar fc-gray2" id="e_name">赵新怡</div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label normal-font">所在地</label>
                    </div>
                    <div class="weui-cell__bd pos-re">
                        <input type="hidden" id="szdztemp"/>
                    <input class="weui-input heer-input fn-ar " style="padding-right: 0.9rem" type="text" placeholder="请输入" id="szdz" name="szdz"  maxlength="20" value="" readonly>
                      <div class="pos-ab-tr normal-font fc-blue" onclick="loadSzdz();" id="open_popup">
                            <i class="iconfont">&#xe633;</i>定位
                        </div>
                       <!-- <input class="weui-input heer-input fn-ar visi-hide" type="text" id="szdz" name="szdz" readonly="">

                         -->
                    </div>
                </div>
                <div class="weui-cell ai-padding">
                    <div class="weui-cell__hd normal-font">日期</div>
                    <div class="weui-cell__bd normal-font fn-ar fc-gray2" id="e_date" >2021-08-17</div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label normal-font"><span class="warn-color">*</span>手机号</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input heer-input fn-ar" type="text" placeholder="请输入" id="sjh" name="sjh" maxlength="20" value="">
                    </div>
                </div>


                <h3 class="ai-padding bg-default normal-font fc-gray4">紧急联系人</h3>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label normal-font">姓名</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input heer-input fn-ar" type="text" placeholder="请输入" id="lxrxm" name="lxrxm" maxlength="40" value="">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd">
                        <label class="weui-label normal-font">联系电话</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input class="weui-input heer-input fn-ar" type="tel" placeholder="请输入" id="lxrsjh" name="lxrsjh" maxlength="40" value="">
                    </div>
                </div>
                <!-- 有异常情况 显示健康信息 -->
                  <h3 class="ai-padding bg-default normal-font fc-gray4">健康情况</h3>
                  <div class="heer-cell pos-re">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>今日体温是否异常：<span class="fc-blue4 fs_12">（高于37.3为异常）</span></h3>
                        <input hidden name="sffr" id="sffr" value="">
                        <div class="content-flex no-bd fn-pt05">
                            <div class="weui-cells_radio align-flex align-p20">
                                <p>早：</p>
                                <div class="align-content-flex">
                                    <label class="clearfix in-block weui-check__label heer-check_radio" for="x21">
                                        <div class="weui-cell__ft fn_fl">
                                            <input type="radio" name="sffrAm" class="weui-check" id="x21"   value="是">
                                        <span class="weui-icon-checked"></span>
                                        </div>
                                        <div class="weui-cell__ft fn_fl">
                                            <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                        </div>
                                        </label>
                                        <label class="clearfix in-block weui-check__label heer-check_radio" for="x22">
                                            <div class="weui-cell__ft fn_fl">
                                                <input type="radio" name="sffrAm" class="weui-check" id="x22" value="否"   checked >
                                            <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__ft fn_fl">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                    </label>
                                </div>
                            </div>
                            <div class="weui-cells_radio align-flex align-p20">
                                <p>中：</p>
                                <div class="align-content-flex">
                                    <label class="clearfix in-block weui-check__label heer-check_radio" for="x23">
                                        <div class="weui-cell__ft fn_fl">
                                            <input type="radio" name="sffrNoon" class="weui-check" id="x23"   value="是">
                                        <span class="weui-icon-checked"></span>
                                        </div>
                                        <div class="weui-cell__ft fn_fl">
                                            <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                        </div>
                                        </label>
                                        <label class="clearfix in-block weui-check__label heer-check_radio" for="x24">
                                            <div class="weui-cell__ft fn_fl">
                                                <input type="radio" name="sffrNoon" class="weui-check" id="x24" value="否"   checked >
                                            <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__ft fn_fl">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                    </label>
                                </div>
                            </div>
                            <div class="weui-cells_radio align-flex align-p20">
                                <p>晚：</p>
                                <div class="align-content-flex">
                                    <label class="clearfix in-block weui-check__label heer-check_radio" for="x25">
                                        <div class="weui-cell__ft fn_fl">
                                            <input type="radio" name="sffrPm" class="weui-check" id="x25"   value="是">
                                        <span class="weui-icon-checked"></span>
                                        </div>
                                        <div class="weui-cell__ft fn_fl">
                                            <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                        </div>
                                        </label>
                                        <label class="clearfix in-block weui-check__label heer-check_radio" for="x26">
                                            <div class="weui-cell__ft fn_fl">
                                                <input type="radio" name="sffrPm" class="weui-check" id="x26" value="否"   checked >
                                            <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__ft fn_fl">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="heer-cell pos-re">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>今日是否有不良反应：<span class="fc-blue4 fs_12">（咳嗽、胸闷、呼吸困难、乏力、发热等症状）</span></h3>
                        <div class="content-flex no-bd vertical-p05">
                            <div class="weui-cells_radio">
                                <label class="flex weui-check__label heer-check_radio" for="x31">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sffy" class="weui-check" id="x31" value="是" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                    </div>
                                </label>
                                <label class="flex weui-check__label heer-check_radio" for="x32">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sffy" class="weui-check" id="x32"  value="否"  checked>
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>
                  <!-- <div class="heer-cell pos-re">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>今日是否接触疑似或确诊病例：</h3>
                        <div class="content-flex no-bd vertical-p05">
                            <div class="weui-cells_radio">
                                <label class="flex weui-check__label heer-check_radio" for="x41">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sfjc" class="weui-check" id="x41" value="是" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                    </div>
                                </label>
                                <label class="flex weui-check__label heer-check_radio" for="x42">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sfjc" class="weui-check" id="x42"  value="否" checked>
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>
                    -->


                    <div class="weui-cell pos-re">
	                    <div class="weui-cell__hd">
	                        <label class="weui-label normal-font"><span class="warn-color">*</span>是否确诊？/疑似？/被隔离？：</label>
	                    </div>
	                    <div class="weui-cell__bd heer-cell-enter">
	                        <input class="weui-input heer-input" type="hidden" id="sfgr" name="sfgr" readonly="" value="">
	                    </div>
	                    <ul class="radio-list clearfix" id="e_unusual">
	                        <li class="radio-item " id="has_un">是</li>
	                        <li class="radio-item active" id="no_un">否</li>
	                    </ul>
	                </div>
	                <div class="heer-cell pos-re" id="div_gr">
                        <div class="content-flex no-bd vertical-p05">
                            <div class="weui-cells_radio">
                                <label class="flex weui-check__label heer-check_radio" for="x52">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="grzk" class="weui-check" id="x52"  value="确诊" onchange="changeGrzt()"   >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">确诊</p>
                                    </div>
                                </label>
                                 <label class="flex weui-check__label heer-check_radio" for="x53">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="grzk" class="weui-check" id="x53"  value="疑似" onchange="changeGrzt()">
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">疑似</p>
                                    </div>
                                </label>
                                <label class="flex weui-check__label heer-check_radio" for="x54">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="grzk" class="weui-check" id="x54"  value="隔离" onchange="changeGrzt()">
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">隔离</p>
                                    </div>
                                </label>
                            </div>
                        </div>



	                <div class="weui-cell" id="div_qzglsj">
	                    <div class="weui-cell__hd">
	                        <label class="weui-label normal-font" id="span_qzglsj"><span class="warn-color">*</span>就诊日期</label>
	                    </div>
	                    <div class="weui-cell__bd">
	                        <input class="weui-input heer-input fn-ar" type="text" placeholder="请输入" id="qzglsj" name="qzglsj" maxlength="40" value="">
	                    </div>
	                </div>

                   <div class="heer-cell pos-re" id="div_qzgldd">
	                  	 <h3 class="normal-font align-p15 fn-pt10" id="span_qzgldd"><span class="warn-color">*</span>就诊地点</h3>
	                    <div class="weui-cell__bd align-p20 fn-pt10 fn-pb10">
	                        <input class="weui-input heer-input fn-al" type="text" placeholder="请输入" id="qzgldd" name="qzgldd" maxlength="40" value="">
	                    </div>
	                </div>
	                <div class="heer-cell pos-re" id="div_glyy">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>隔离原因：<span class="fc-blue4 fs_12">（本人持续发烧、密切接触持续发烧、其他原因）</span></h3>
                        <div class="content-flex no-bd vertical-p05">
                        <input type="hidden" name="glyy" id="glyy" value=""/>
                            <div class="weui-cells_radio">
                                <label class="flex weui-check__label heer-check_radio" for="x41">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="glyy1" class="weui-check" id="x41" value="本人持续发烧" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">本人持续发烧</p>
                                    </div>
                                </label>
                                <label class="flex weui-check__label heer-check_radio" for="x42">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="glyy1" class="weui-check" id="x42"  value="密切接触持续发烧" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">密切接触持续发烧</p>
                                    </div>
                                </label>
                                 <label class="flex weui-check__label heer-check_radio" for="x43">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="glyy1" class="weui-check" id="x43"  value="其他原因" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">其他原因</p>
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>
<!-- 	                <div class="heer-cell pos-re" > -->
<!-- 	                	<h3 class="normal-font align-p15 fn-pt10"></h3> -->
<!-- 	                    <div class="weui-cell__bd align-p20 fn-pt10 fn-pb10"> -->
<!-- 	                        <input class="weui-input heer-input fn-al" type="text" placeholder="请输入隔离原因" id="glyy" name="glyy" maxlength="40" value=""> -->
<!-- 	                    </div> -->
<!-- 	                </div> -->
	                <div class="heer-cell pos-re" id="div_mqzz">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>目前身体状况简单描述：</h3>
                        <div class="weui-cell__bd align-p20 fn-pt10 fn-pb10">
                            <textarea class="weui-textarea normal-font" id="mqzz" name="mqzz" placeholder="点击输入文字" rows="5" ></textarea>
                            <div class="weui-textarea-counter heer-grayFont"><span id="text-mqzz">0</span>/200字</div>
                        </div>
                    </div>
            </div>
	                 <div class="heer-cell pos-re">
                        <h3 class="normal-font align-p15 fn-pt10"><span class="warn-color">*</span>今日是否进出校园：<span class="fc-blue4 fs_12">（未接到学校通知不得返校）</span></h3>
                        <div class="content-flex no-bd vertical-p05">
                            <div class="weui-cells_radio">
                                <label class="flex weui-check__label heer-check_radio" for="x61">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sffx" class="weui-check" id="x61" value="是" >
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">是</p>
                                    </div>
                                </label>
                                <label class="flex weui-check__label heer-check_radio" for="x62">
                                    <div class="weui-cell__ft">
                                        <input type="radio" name="sffx" class="weui-check" id="x62"  value="否"  checked>
                                        <span class="weui-icon-checked"></span>
                                    </div>
                                    <div class="weui-cell__bd">
                                        <p class="heer-radio normal-sm-font fc-gray4">否</p>
                                    </div>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="heer-cell pos-re">
                        <h3 class="normal-font align-p15 fn-pt10">其他健康情况：</h3>
                        <div class="weui-cell__bd align-p20 fn-pt10 fn-pb10">
                            <textarea class="weui-textarea normal-font" id="qt" name="qt" placeholder="点击输入文字" rows="5" ></textarea>
                            <div class="weui-textarea-counter heer-grayFont"><span id="text-qt">0</span>/200字</div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </section>
    <div class="ai-padding bg-white fixed-bottom w100 fit_768">
        <button type="button" class="submit-btn" id="submit_btn" onclick="sendEvent()">提交</button>
    </div>
    <!-- 提交成功前 遮罩层 -->
    <div id="submit_modal" class="weui-popup__container heer-popup-container z_999">
        <div class="weui-popup__overlay z_999"></div>
        <div class="weui-popup__modal fn-ac bg-tran z_999" style="padding-top: 20%;">
            <i class="weui-loading weui-icon_toast fc-white"></i>
            <p class="fc-white">努力提交中，请稍等</p>
        </div>
    </div>

<!-- 底部弹出框 -->
<div class="weui-actionsheet top-shadow bg-white" id="weui_actionsheet">
    <div class="weui-actionsheet__title bg-white fc-black lh_40" style="height: 0.8rem;">
        <p class="weui-actionsheet__title-text">选择您的地址</p>
    </div>
    <!-- 地址列表 -->
    <ul class="bottom-popup-lists" id="addressList"></ul>
</div>
</main>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=97XRr8hlelA2SIUksaCMxwc0I6lfl4bf"></script>
<script src="/static/modular/xyt/js//city-picker.js?v=1.2"></script>
<script>
var latitude,longitude;
var issubmit=false;
    $(function(){
        /* 字数限制 */
        $("#qt").on("input propertychange", function() {
            var $this = $(this),
                _val = $this.val(),
                count = "";
            if (_val.length > 200) {
                $this.val(_val.substring(0, 200));
            }
            count = $this.val().length;
            $("#text-qt").text(count);
        });
        $("#mqzz").on("input propertychange", function() {
            var $this = $(this),
                _val = $this.val(),
                count = "";
            if (_val.length > 200) {
                $this.val(_val.substring(0, 200));
            }
            count = $this.val().length;
            $("#text-mqzz").text(count);
        });
        // 健康信息 显示隐藏
        var isFlag;
        $('.radio-item').on('click',function(){
            $(this).addClass('active').siblings('.radio-item').removeClass('active');
            isFlag = $(this).text();
            if(isFlag=="是"){
            	$("#sfgr").val("是");

                $('#div_gr').show();
            }else{
            	$("#sfgr").val("否");
                $('#div_gr').hide();
                $('input[name=grzk]').removeClass('checked');

            }
        })

      //选择籍贯
		   changeGrzt();

    })

    function changeGrzt(){
    	var sfgr = $("#sfgr").val();
   	 	 $("#div_qzglsj").hide();
    	$("#div_glyy").hide();
    	$("#div_qzgldd").hide();
    	$("#div_mqzz").hide();
    	$('#div_gr').hide();
	   	if(sfgr=="是"){
	    	 var grzk=$("input[name='grzk']:checked").val();
	         if(grzk=="确诊"){
	      	    $("#sfqz").val("是");
	      	    $("#span_qzglsj").html('<span class="warn-color">*</span>确诊时间');
	      		$("#span_qzgldd").html('<span class="warn-color">*</span>就诊医院名称');
	      		$("#div_glyy").hide();
	         }else if(grzk=="疑似"){
	      	   $("#sfys").val("是");
	      	   $("#span_qzglsj").html('<span class="warn-color">*</span>就诊时间');
	      		$("#span_qzgldd").html('<span class="warn-color">*</span>医院名称');
	      		$("#div_glyy").hide();
	         }else if(grzk=="隔离"){
	      	   $("#sfgl").val("是");
	      	   $("#span_qzglsj").html('<span class="warn-color">*</span>隔离时间');
	      		$("#span_qzgldd").html('隔离地点<span class="fc-blue4 fs_12">（医院名称/社区名称/居家隔离/其他）</span>');
	      		$("#div_glyy").show();
	         }
	         $("#div_qzglsj").show();
	      	$("#div_qzgldd").show();
	         $("#div_mqzz").show();
	         $('#div_gr').show();
	         //开启日期选择
	         var date = new Date();
// 	         $("#qzglsj").calendar({
// 	inputReadOnly:true,
// 	        	 dateFormat:	'yyyy-mm-dd',
// 	         		maxDate:"2021-08-17"
// 	        	});
		        $('#qzglsj').datetimePicker({
		            times: function () {
		                return [];
		            },
		            max:date
		        }).val("");
	   	}
    }

    function loadSzdz(){
    	//加载wxconfig
        $.ajax({
            url: Feng.ctxPath + '/wx/index/getJsapi.do',
            data:{
                "url":window.location.href.split('#')[0]// 获取页面当前链接
            },
            type: "POST",
            dataType: 'json', // 服务器返回的格式,可以是json或xml等
            success: function (result) { // 服务器响应成功时的处理函数
                // alert(result.jsapi_ticket);
                wx.config({
                    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来
                    appId: result.appId, // 必填，公众号的唯一标识
                    timestamp: result.timestamp, // 必填，生成签名的时间戳
                    nonceStr: result.noncestr, // 必填，生成签名的随机串
                    signature:result.signature,// 必填，签名，见附录1
                    jsApiList: [
                        "getLocation"
                    ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
                });
                wx.error(function (res) {
                    // alert(res);
                });
                wx.ready(function () {
                    wx.getLocation({
                        type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
                        success: function (res) {
                            latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90
                            longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。
                            console.log('微信定位成功；');

                            //transXy();
                            $("#longitude").val(longitude);
                            $("#latitude").val(latitude);
                            transAddress();
                        },
                        fail: function(){
                            console.log('微信定位失败；');
                        }
                    });
                });
            }
        });
    }

    function transXy() {
        var url = "http://api.map.baidu.com/geoconv/v1/?coords="+longitude+","+latitude+"&from=1&to=5&ak=97XRr8hlelA2SIUksaCMxwc0I6lfl4bf";
        $.ajax({
            url: url,
            type: 'GET',
            async:false,//设置同步。ajax默认异步
            dataType: 'jsonp',
            jsonp:'callback',//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
            jsonpCallback:"callback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
            timeout: 5000,
            contentType: 'application/json; charset=utf-8',
            success: function (data){
                console.log(data);
                var status=data.status;
                if(status=="0"){
                    var result = data.result[0];
                    longitude=result.x;
                    latitude=result.y;
                    $("#longitude").val(longitude);
                    $("#latitude").val(latitude);
                    transAddress();
                }
            }
        })
        jQuery.getScript(url);
    }

    function sendEvent(){
    	if(issubmit){
			 $.toptip('请不要重复提交！', 'error');
			 return false;
		 }
		issubmit=true;
    	var sfgr = $("#sfgr").val();
        $("#sfqz").val("否");
        $("#sfys").val("否");
        $("#sfzy").val("否");
        $("#sfgl").val("否");
	   	if(sfgr=="是"){
	    	 var grzk=$("input[name='grzk']:checked").val();
	    	 var title_sj="";
	    	 var title_dd="";
	         if(grzk=="确诊"){
	      	  	 $("#sfqz").val("是");
	      		 title_sj="确诊时间";
	      		 title_dd="就诊医院名称";
	         }else if(grzk=="疑似"){
	      	   	 $("#sfys").val("是");
	      	  	 title_sj="就诊时间";
	      		 title_dd="就诊医院名称";
	         }else if(grzk=="隔离"){
	      	  	 $("#sfgl").val("是");
	      	  	title_sj="隔离时间";
	      		 title_dd="隔离地点";
	      		var eTemp=$("input[name='glyy1']:checked").val();
		          if(eTemp==""||eTemp==undefined||eTemp=="undefined"){
		              $.toast("请填写隔离原因", "text");
		              issubmit=false;
		              return false;
		          }
		          $("#glyy").val(eTemp);
	         }else{
	        	 $.toast("请选择确诊？/疑似？/被隔离？", "text");
	        	 issubmit=false;
	             return false;
	         }

	          var eTemp = $.trim($('#qzglsj').val());
	          if(eTemp==""){
	              $.toast("请填写"+title_sj, "text");
	              issubmit=false;
	              return false;
	          }
	          var eTemp = $.trim($('#qzgldd').val());
	          if(eTemp==""){
	              $.toast("请填写"+title_dd, "text");
	              issubmit=false;
	              return false;
	          }
	          var eTemp = $.trim($('#mqzz').val());
	          if(eTemp==""){
	              $.toast("请填写目前身体状况简单描述", "text");
	              issubmit=false;
	              return false;
	          }
	   	}else{
	   		$('#qzglsj').val("");
	   		$('#qzgldd').val("");
	   		$('#glyy').val("");
	   		$('#mqzz').val("");
	   	}
    	var eTemp = $.trim($('#sjh').val());
        if(eTemp==""){
            $.toast("请填写手机号", "text");
            issubmit=false;
            return false;
        }
        if(!(/^1[3456789]\d{9}$/.test(eTemp))){
       	 $.toast("手机号码有误，请重填", "text");
       	issubmit=false;
           return false;
       }

        var eTemp = $.trim($('#lxrsjh').val());
        if(eTemp!=""){
	        if(!(/^1[3456789]\d{9}$/.test(eTemp))){
	       	 $.toast("联系人手机号码有误，请重填", "text");
	       	issubmit=false;
	           return false;
	       }
        }

        var eTemp = $.trim($('#szdz').val());
        if(eTemp==""){
            $.toast("请定位所在地", "text");
            issubmit=false;
            return false;
        }
       //如果有异常情况
//        if($('#has_un').hasClass('active')){
//            var eTemp = $.trim($('#tw').val());
//            //体温必填
//            if(eTemp==""){
//                $.toast("请填写体温", "text");
// issubmit=false;
//                return false;
//            }
//        }


       var szdz = $("#szdz").val();
       var adcode=$("#szdz").attr("data-code");
       if(adcode!=""&&adcode!=null){
    	   $("#adcode").val(adcode);

       }

       var arr = szdz.split(" ");
	   /*if(arr.length!=3){
		   arr = szdz.split("-");
	   }*/
	   if(arr.length>=1)  $("#province").val(arr[0]);
	   if(arr.length>=2)   $("#city").val(arr[1]);
	   if(arr.length>=3)  $("#district").val(arr[2]);

       //处理异常状态
        var sffrAm=$("input[name='sffrAm']:checked").val();
        var sffrNoon=$("input[name='sffrNoon']:checked").val();
        var sffrPm=$("input[name='sffrPm']:checked").val();
        if (sffrAm=="是"||sffrNoon=="是"||sffrPm=="是"){
            $("#sffr").val("是");
        }else {
            $("#sffr").val("否");
        }


        var sffr=$("#sffr").val();
        var sffy=$("input[name='sffy']:checked").val();
//         var sfjc=$("input[name='sfjc']:checked").val();
//        if(sffr=="是"||sffy=="是"||sfgr=="是"||sfjc=="是"){
	 if(sffr=="是"||sffy=="是"||sfgr=="是"){
    	   $("#status").val("2");
       }else{
    	   $("#status").val("1");
       }

    	$.confirm("确定要提交吗？", function() {

    		$("#submit_modal").popup();//提交前打开遮罩
           var data=$('#f').serialize();
      	    var url = '/wx/health/saveApply.do';
      		$.ajax({
              url:url,
              type:'POST',
              dataType: "json",
              data:data,
              success:function (data) {
            	  $.closePopup();//完成后关闭遮罩
              	if(data.msgStatus=="true"){
              	 	$.toptip('提交成功', 'success');
              		 window.location=Feng.ctxPath + "/wx/health/main.do";
              	}else{
              		issubmit=false;
              		$.toptip(data.msgText, 'error');
              	}
              }

          })           
        }, function() {
            //点击取消后的回调函数
			issubmit=false;
            return false;
        });


        //跳转链接
    }

function transAddress(){
    var url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak=97XRr8hlelA2SIUksaCMxwc0I6lfl4bf&output=json&coordtype=wgs84ll&location="+latitude+","+longitude+"&radius=300&extensions_town=true&extensions_road=true&extensions_poi=1";
    $.ajax({
        url: url,
        type: 'GET',
        async:false,//设置同步。ajax默认异步
        dataType: 'jsonp',
        jsonp:'callback',//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
        jsonpCallback:"callback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
        timeout: 5000,
        contentType: 'application/json; charset=utf-8',
        success: function (data){
            console.log(data);
            var status=data.status;
            if(status=="0"){
                var result = data.result.addressComponent;
                var province = result.province;
                var city = result.city;
                var district = result.district;
                var adcode = result.adcode;
                $("#province").val(province);
                $("#city").val(city);
                $("#district").val(district);
                $("#adcode").val(adcode);
                $("#szdz").attr("data-code",adcode);
                //alert(JSON.stringify(pois));
                    $("#szdz").val(province+" "+city+" "+district);
            }
        }
    })
}
function showAddressSelect(){
    $('#weui_mask').addClass('weui-mask--visible');
    $('.weui-actionsheet').addClass('weui-actionsheet_toggle');//呼出弹出框
    $('.bottom-popup-lists .address-item').on('click',function(){
        $(this).addClass('active').siblings('.address-item').removeClass('active');
        var address = $(this).find('.address-details').text();
        $("#szdz").val($("#szdztemp").val()+" "+address);
        //选定关闭弹框
        setTimeout(function(){
            $('.weui-actionsheet').removeClass('weui-actionsheet_toggle');
            $('#weui_mask').removeClass('weui-mask--visible');
        },300)
    })
}
</script>
</body>
</html>